#include<iostream>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>

void handler(int signo)
{
  std::cout<<"get a signo: "<<signo<<std::endl;
}


int main()
{
  std::cout<<"get a pid"<<getpid()<<std::endl;
  struct sigaction ac,oac;
  ac.sa_handler=handler;
  ac.sa_flags=0;
  sigemptyset(&ac.sa_mask);
  sigaction(2,&ac,&oac);
  while(true)
  {
    std::cout<<"main running ..."<<std::endl;
    sleep(2);
  }
  return 0;
}
